NB_THREADS=8
TREIBER_STACK=1

FILES=Makefile non_blocking.* stack.* Questions/questions.pdf
ARCHIVE=Lab3.zip

CFLAGS=-g -O0 -Wall -pthread -DNB_THREADS=$(NB_THREADS) -DTREIBER_STACK=$(TREIBER_STACK)
OUT=stack

all: $(OUT)

clean:
	$(RM) stack
	$(RM) stack-*
	$(RM) *.o
	$(RM) *.zip
	
$(OUT): stack_test.c stack.o nonblocking.o
	gcc $(CFLAGS) stack.o non_blocking.o stack_test.c -o $(OUT) -lrt

stack.o: stack.c stack.h
	gcc $(CFLAGS) -c -o stack.o stack.c
	
nonblocking.o: non_blocking.c
	gcc $(CFLAGS) -c -o non_blocking.o non_blocking.c

.PHONY: all clean dist

dist:
	zip $(ARCHIVE) $(FILES)
